<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /*
       Promise.race 谁的状态先改变（不管成功还是失败）就是谁
        */
        let r1 = Promise.resolve('a');
        let r2 = Promise.reject('b');
        let r3 = Promise.resolve('c');
        let p = Promise.race([r1, r2, r3])
            .then((res) => {
                console.log(res); //输出a后不执行
            })
            .catch((error) => {
                console.log(error); //不执行
            });
        console.log(p)
    </script>

</body>

</html>